package company.chubao;

import java.util.Scanner;

public class Chu4A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        String[] array1 = s1.split(" ");
        String[] array2 = s2.split(" ");
        int n = array1.length;
        int min1 = Integer.MAX_VALUE;
        int min2 = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            min1 = Math.min(min1, Integer.parseInt(array1[i]));
            min2 = Math.min(min2, Integer.parseInt(array2[i]));
        }
        System.out.println(min1 + min2);
    }
}
